﻿//        Another Demo from Andy L. & MissedMemo.com
// Borrow whatever code seems useful - just don't try to hold
// me responsible for any ill effects. My demos sometimes use
// licensed images which CANNOT legally be copied and reused.

using System.ServiceModel;


namespace MissedMemo.MeatAndCheeseDisc.Services
{
    class Host
    {
        private static ServiceHost _hostOrderEntryManagementService = null;
        private static ServiceHost _hostKitchenOrderMonitorService = null;


        internal static void StartServices()
        {
            _hostOrderEntryManagementService = new ServiceHost( typeof( OrderEntryManagementService ) );
            _hostOrderEntryManagementService.Open();

            _hostKitchenOrderMonitorService = new ServiceHost( typeof( KitchenOrderMonitorService ) );
            _hostKitchenOrderMonitorService.Open();
        }

        internal static void StopServices()
        {
            if( _hostOrderEntryManagementService.State != CommunicationState.Closed )
                _hostOrderEntryManagementService.Close();

            if( _hostKitchenOrderMonitorService.State != CommunicationState.Closed )
                _hostKitchenOrderMonitorService.Close();
        }
    }
}
